package com.zrt.pad.commonui;


import java.util.Locale;
import java.util.TimeZone;

import android.content.Context;

import com.zrt.pad.commonui.task.SyncDaemonThread;
import com.zrt.pad.datasource.db.CustomDBHelper;
import com.mobilepos.MainApp;

public class SharedApplication extends MainApp {

	public static Context context;
	
	@Override
	public void onCreate() {
		super.onCreate();
		context = this;
		new CustomDBHelper(context).getReadableDatabase().close();
		
//		Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
//			
//			@Override
//			public void uncaughtException(Thread thread, Throwable ex) {
//				try {
//					OutputStream os = openFileOutput("error_log.txt", MODE_APPEND);
//					PrintStream ps = new PrintStream(os);
//					ex.printStackTrace(ps);
//				} catch (FileNotFoundException e) {
//					e.printStackTrace();
//				}
//				Runtime.getRuntime().exit(1);
//			}
//		});
		
		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
		Locale.setDefault(Locale.CHINA);
		new SyncDaemonThread().start();
	}
	
}
